package cn.com.git.workflow.server.api.feign;

import cn.com.git.workflow.server.api.feign.workflow.WorkflowFeignService;
import feign.Feign;
import feign.Request;
import feign.jackson.JacksonDecoder;
import feign.jackson.JacksonEncoder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zhangzhenfu
 * @Description
 * @date 2020/4/8 10:39
 */
@Configuration
public class FeignConfiguration {

    @Value("${feign.url}")
    private String feignUrl ;

    @Bean
    public WorkflowFeignService buildWorkflowFeignService(){
        return Feign.builder()
                .decoder(new JacksonDecoder())
                .encoder(new JacksonEncoder())
                .options(new Request.Options(10000,15*60*1000))
                .target(WorkflowFeignService.class, feignUrl);
    }


}
